/* global redux_change */
jQuery.noConflict();
jQuery(document).ready(function($) {
	/**
	 * Switch
	 * Dependencies		: jquery
	 * Feature added by	: Smartik - http://smartik.ws/
	 * Date				: 03.17.2013
	 */
	jQuery(".cb-enable").click(function() {
		if (jQuery(this).hasClass('selected')) {
			return;
		}
		var parent = $(this).parents('.switch-options');
		jQuery('.cb-disable', parent).removeClass('selected');
		jQuery(this).addClass('selected');
		jQuery('.checkbox-input', parent).val(1);
		redux_change(jQuery('.checkbox-input', parent));
		//fold/unfold related options
		var obj = jQuery(this);
		var $fold = '.f_' + obj.data('id');
		jQuery($fold).slideDown('normal', "swing");
	});
	jQuery(".cb-disable").click(function() {
		if (jQuery(this).hasClass('selected')) {
			return;
		}
		var parent = $(this).parents('.switch-options');
		jQuery('.cb-enable', parent).removeClass('selected');
		jQuery(this).addClass('selected');
		jQuery('.checkbox-input', parent).val(0);
		redux_change(jQuery('.checkbox-input', parent));
		//fold/unfold related options
		var obj = jQuery(this);
		var $fold = '.f_' + obj.data('id');
		jQuery($fold).slideUp('normal', "swing");
	});
	//disable text select(for modern chrome, safari and firefox is done via CSS)
	//if (($.browser.msie && $.browser.version < 10) || $.browser.opera) { 
	$('.cb-enable span, .cb-disable span').find().attr('unselectable', 'on');
	//}
});